package cate.common.table.activity.fairygift;

import cate.common.table.ESheet;
import easy.java.dev.note.NoteField;

import java.util.List;
import java.util.stream.Collectors;

public class FairyGiftConfigSheet extends ESheet<FairyGiftConfigRow> {
    @Override
    public String getSheetName() {
        return "礼包配置";
    }

    public List<FairyGiftConfigRow> getConfig(int configTid) {
        return getList().stream().filter(row -> row.confId == configTid).collect(Collectors.toList());
    }

    public FairyGiftConfigRow getRowByItemId(int id, int configTid) {
        for (FairyGiftConfigRow row : list) {
            if (row.id == id && row.confId == configTid) {
                return row;
            }
        }
        return null;
    }

    public FairyGiftConfigRow getRowByPayItemId(int payItemId, int configTid) {
        for (FairyGiftConfigRow row : list) {
            if (row.payItemId == payItemId && row.confId == configTid) {
                return row;
            }
        }
        return null;
    }
}
